<template>
    <div class="sjplatformDetailForm">
        <div class="title-div">基本信息</div>
        <el-form label-width="120px">
            <el-form-item label="项目名称：">
                <span>{{ projectDetail.data.projectName }}</span>
            </el-form-item>
            <el-form-item label="项目依据：">
                <span>{{ projectDetail.data.basis }}</span>
            </el-form-item>
            <el-form-item label="项目描述：">
                <span>{{ projectDetail.data.description }}</span>
            </el-form-item>
            <el-form-item label="项目经理：">
                <span>{{ projectDetail.data.managerName }}</span>
            </el-form-item>
            <el-form-item label="项目开始日期：">
                <span>{{ commonUtil.Methods.formatDate(projectDetail.data.startTime) }}</span>
            </el-form-item>
            <el-form-item label="项目结束日期：">
                <span>{{ commonUtil.Methods.formatDate(projectDetail.data.endTime) }}</span>
            </el-form-item>
            <el-form-item label="项目状态：">
                <span>{{ getStatusEnumChineseByValue(projectDetail.data.status, ProcessEnum.CreateProject) }}</span>
            </el-form-item>
            <el-form-item label="项目创建时间：">
                <span>{{ commonUtil.Methods.formatDate(projectDetail.data.addTime) }}</span>
            </el-form-item>
            <el-form-item label="立项文档：">
                <div v-if="historyFileList" class="uploadHis">
                    <ul class="file-list">
                        <li v-for="file in historyFileList" :key="file.objectId">
                            {{ file.fileName }}
                            <el-tooltip content="下载" placement="bottom" effect="light">
                                <i class="download-icon"
                                    @click="fileOpeartion.downloadFile(file.objectId, file.fileName)"></i>
                            </el-tooltip>
                        </li>
                    </ul>
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>

<script lang="ts" setup>
import { ref, defineProps } from 'vue';
import { useProjectDetail } from '../../../hooks/ProjectManager/Common/useProjectDetail';
import { useProjectTable } from "../../../hooks/ProjectManager/Start/useProjectTable";
import commonUtil from "../../../utils/common";
import { ProcessEnum, getStatusEnumChineseByValue } from "../../../hooks/Common/useStatusEnum";
import { useFileOperation } from '../../../hooks/Common/useFileOperation';

let receivedProps = defineProps(['projectId']);

let fileOpeartion = useFileOperation();

let { projectTable, getProjectDoc } = useProjectTable(1, 10);
let { projectDetail, getDetail } = useProjectDetail()
let historyFileList = ref();
getDetail(receivedProps.projectId).then(() => {

});
//获取立项文档
getProjectDoc(receivedProps.projectId, 1).then(() => {
    historyFileList.value = projectTable.documentList;
});
</script>